package com.javasm.crm.controller.marketingActivity;

import com.javasm.crm.common.http.AxiosResult;
import com.javasm.crm.domin.entity.marketingActivity.Marketing;
import com.javasm.crm.domin.entity.marketingActivity.clinetClaim.MarketingFindClaim;
import com.javasm.crm.service.marketingActivity.MarketingService;
import com.javasm.crm.utils.page.PageResult;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author：llyp
 * @Version：1.0
 * @Date：2021/7/12-15:53
 * @Since:jdk1.8
 * @Description:TODO
 */
@RestController
@RequestMapping("/Marketing")
@Api(value = "MarketingController" ,description = "市场活动明细单")
public class MarketingController {

    @Autowired
    private MarketingService marketingService;

    /**
     * 查询所有
     * @return
     */
    @GetMapping("findAll")
    public AxiosResult<List<Marketing>> finaAll(){
        return AxiosResult.success(marketingService.list());
    }

    /**
     * 分页条件查询
     * @return
     */
    @PostMapping("findCondition")
    public AxiosResult<PageResult> pageFind(@RequestBody MarketingFindClaim mfc){
        System.out.println("页面次数信息=====》"+mfc);

        PageResult<Marketing> marketingPageResult = marketingService.ConditionFindPage(mfc);

        return AxiosResult.success(marketingPageResult);
    }

}
